<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script type="text/javascript">
        function disp_confirm()
          {
          var r=confirm("Press a button")
          if (r==true)
            {
            document.write("You pressed OK!")
            }
          else
            {
            document.write("You pressed Cancel!")
            }
          }

          function disp_prompt()
            {
            var name=prompt("Please enter your name","demo")
            if (name!=null && name!="")
                {
                document.write("Hello " + name + "!")
                }
            }

            function loc() {
                window.location.href="http://www.163.com";
            }

            function rel() {
                window.location.reload();
            }
        </script>
</head>
<body>
    <input type="button" onclick="disp_confirm()" value="Display a confirm box" />
    <input type="button" onclick="disp_prompt()" value="Display a prompt box" />
    <input type="button" onclick="loc()" value="跳转页面" />
    <input type="button" onclick="rel()" value="重载页面" />
</body>
</html>